import sys
input = sys.stdin.readline
def f(a1, b1, c1, d1, e1, f1, g):
a, b, c, d, e, f = a1.copy(), b1.copy(), c1.copy(), d1.copy(), e1.copy(), f1.copy()
if len(set(a)) == len(set(b)) == 1:
if g == 1:
for i in [c, d, e, f]:
i[1], i[2] = i[2], i[1]
elif g == 2:
d[1], d[2] = d[2], d[1]
e[0], e[1], e[2], e[3] = e[2], e[3], e[0], e[1]
f[0], f[3] = f[3], f[0]
if f[0] == f[1]:
x = f[0]
for i1, i2, i3, i4 in [c,d,e,f]:
if x == i3 == i4:
if i1 == i2:
x = i1
else:
break
else:
break
else:
return 1
x = f[0]
for i1, i2, i3, i4 in [e,d,c,f]:
if x == i3 == i4:
if i1 == i2:
x = i1
else:
break
else:
break
else:
return 1
return 0
w = list(map(int, input().split()))
a1 = w[:4]
a2 = w[4:8]
a3 = w[8:12]
a4 = w[12:16]
a5 = w[16:20]
a6 = [w[21], w[20], w[23], w[22]]
if sum([f(a1, a3, a4, a2, a5, a6, 0), f(a2, a6, a1, a4, a3, a5, 2), f(a4, a5, a1, a2, a3, a6, 1)]) >= 1:
print('YES')
else:
print('NO')
1657C - Bracket Sequence Deletion | 1657B - XY Sequence |
1009A - Game Shopping | 1657A - Integer Moves |
230B - T-primes | 630A - Again Twenty Five |
1234D - Distinct Characters Queries | 1183A - Nearest Interesting Number |
1009E - Intercity Travelling | 1637B - MEX and Array |
224A - Parallelepiped | 964A - Splits |
1615A - Closing The Gap | 4C - Registration System |
1321A - Contest for Robots | 1451A - Subtract or Divide |
1B - Spreadsheet | 1177A - Digits Sequence (Easy Edition) |
1579A - Casimir's String Solitaire | 287B - Pipeline |
510A - Fox And Snake | 1520B - Ordinary Numbers |
1624A - Plus One on the Subset | 350A - TL |
1487A - Arena | 1520D - Same Differences |
376A - Lever | 1305A - Kuroni and the Gifts |
1609A - Divide and Multiply | 149B - Martian Clock |